# Contributor: Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=revive
pkgver=1.3.1
pkgrel=1
pkgdesc="faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint"
arch=('loong64' 'x86_64')
url='https://revive.run'
license=('MIT')
depends=('glibc')
makedepends=('go')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mgechev/revive/archive/v${pkgver}.tar.gz")
sha256sums=('b3b8804024cd2aadb0900912560ad8718d5d1fc47fba7d95d281b46a24352267')

build() {
  cd revive-${pkgver}
  export CGO_LDFLAGS="${LDFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
  go build
}

check() {
  cd revive-${pkgver}/test
  go test || true
}

package() {
  cd revive-${pkgver}
  install -Dm755 revive "${pkgdir}/usr/bin/revive"
  install -Dm644 defaults.toml "${pkgdir}/etc/revive/revive.toml"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
